<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/linear/linked/sclnk.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/linear/linked/sclnk.h</h1>  </div>
</div>
<div class="contents">
<a href="sclnk_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_SCLNK__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_SCLNK__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="cdef_8h.html" title="Definitions and declarations for common constants, types, variables.">../../../port/cdef.h</a>&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00022"></a>00022 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00023"></a>00023 
<a name="l00040"></a><a class="code" href="struct____sclnk__node.html">00040</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">__sclnk_node</a> {
<a name="l00042"></a><a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2">00042</a>     <span class="keyword">struct </span><a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">__sclnk_node</a>* <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00043"></a>00043 }<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf0ca87651df00926c16a0d79824c40ca" title="节点">sclnk_node</a>, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga94ea68164448a47de7af62b6d8e6aac9" title="表头">sclnk_head</a>, *<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac57396cc7f5239b52d30d83fb3d0fd45" title="迭代器">sclnk_iter</a>;
<a name="l00044"></a>00044 
<a name="l00053"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1622ab9d53f1304f3bcfc799d8d31d58">00053</a> <span class="preprocessor">#define SCLNK_HEAD(name) sclnk_head name = {&amp;(name)}</span>
<a name="l00054"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad06fab6e1450ea947d4b1c959807c4b7">00054</a> <span class="preprocessor"></span><span class="preprocessor">#define SCLNK_NODE(name) sclnk_node name = {&amp;(name)}</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00062"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270">00062</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270" title="单参数回调函数指针">sclnk_pr1</a>)(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_node</a>*);
<a name="l00063"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3e8dfdfaf04c5f01bf0234f42094d1df">00063</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3e8dfdfaf04c5f01bf0234f42094d1df" title="双参数回调函数指针">sclnk_pr2</a>)(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_node</a>*, sclnk_node*);
<a name="l00064"></a>00064 
<a name="l00077"></a>00077 NV_API <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga872679837eaeacd2383f86cdbfa3e406" title="判断链表结构是否正常">sclnk_check</a>(sclnk_head* head, sclnk_iter* loop_entry);
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="preprocessor">#define SCLNK_CHECK_PASS    0 </span><span class="comment">/* 正常 */</span>
<a name="l00080"></a>00080 <span class="preprocessor">#define SCLNK_CHECK_LOOP    1 </span><span class="comment">/* 有非法环路 */</span>
<a name="l00081"></a>00081 <span class="preprocessor">#define SCLNK_CHECK_NULL    2 </span><span class="comment">/* 有节点指向NULL */</span>
<a name="l00082"></a>00082 
<a name="l00094"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga852e7b04205d953bf29519fb39e40a96">00094</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga852e7b04205d953bf29519fb39e40a96" title="初始化表头">sclnk_init</a>(sclnk_head* head)
<a name="l00095"></a>00095 {
<a name="l00096"></a>00096     head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = head;
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00113"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf12c4deb46369bbaeb098b195b05ced0">00113</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf12c4deb46369bbaeb098b195b05ced0" title="判断表是否为空">sclnk_empty</a>(sclnk_head* head)
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> == head;
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __sclnk_singular(sclnk_node* front, sclnk_node* end)
<a name="l00119"></a>00119 {
<a name="l00120"></a>00120     <span class="keywordflow">return</span> (front != end &amp;&amp; front-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> == end);
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00137"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga12db6bd31db5178a3f01bb1ddd008ad4">00137</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga12db6bd31db5178a3f01bb1ddd008ad4" title="判断表是否只有单个节点">sclnk_singular</a>(sclnk_head* head)
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139     <span class="keywordflow">return</span> __sclnk_singular(head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, head);
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141 
<a name="l00164"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga98ef86b8ad902392bb2f00d933469677">00164</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga98ef86b8ad902392bb2f00d933469677" title="判断表是否可以排序">sclnk_sortable</a>(sclnk_iter begin, sclnk_iter end)
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166     <span class="keywordflow">return</span> (begin != end &amp;&amp; begin-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> != end);
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 
<a name="l00197"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8ad3457e9c3e3ab59804b27d70410a52">00197</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8ad3457e9c3e3ab59804b27d70410a52" title="判断表是否可以序列化">sclnk_serialable</a>(sclnk_head* head)
<a name="l00198"></a>00198 {
<a name="l00199"></a>00199     <span class="keywordflow">return</span> !!head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00200"></a>00200 }
<a name="l00201"></a>00201 
<a name="l00209"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6655e61e67c2f0cd0206fdd22af55948">00209</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6655e61e67c2f0cd0206fdd22af55948" title="链接两个节点">sclnk_link</a>(sclnk_iter prev, sclnk_iter <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>)
<a name="l00210"></a>00210 {   <span class="comment">/* 强制连接prev节点和next节点</span>
<a name="l00211"></a>00211 <span class="comment">     * --(prev)-&gt; &lt;-(next)-- ==&gt; --(prev)--(next)--</span>
<a name="l00212"></a>00212 <span class="comment">     */</span>
<a name="l00213"></a>00213     prev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215 
<a name="l00227"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603">00227</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(sclnk_node* newly, 
<a name="l00228"></a>00228                                                 sclnk_iter prev, 
<a name="l00229"></a>00229                                                 sclnk_iter <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>)
<a name="l00230"></a>00230 {   <span class="comment">/* 强制连接prev节点和next节点，并在两者之间插入newly节点</span>
<a name="l00231"></a>00231 <span class="comment">     * (1) prev节点和next节点原来未连接 </span>
<a name="l00232"></a>00232 <span class="comment">     *       (newly)</span>
<a name="l00233"></a>00233 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00234"></a>00234 <span class="comment">     * --(prev) (next)--</span>
<a name="l00235"></a>00235 <span class="comment">     * (2) prev节点和next节点原来已连接 </span>
<a name="l00236"></a>00236 <span class="comment">     *       (newly)</span>
<a name="l00237"></a>00237 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00238"></a>00238 <span class="comment">     * --(prev)-(next)--</span>
<a name="l00239"></a>00239 <span class="comment">     */</span>
<a name="l00240"></a>00240     prev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = newly;
<a name="l00241"></a>00241     newly-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00242"></a>00242     <span class="comment">/* (1)连接prev节点与newly节点  (2)再连接newly节点与next节点</span>
<a name="l00243"></a>00243 <span class="comment">     *          (newly)                    (newly)</span>
<a name="l00244"></a>00244 <span class="comment">     *          /                          /    \</span>
<a name="l00245"></a>00245 <span class="comment">     *    --(prev)  (next)--         --(prev)  (next)--</span>
<a name="l00246"></a>00246 <span class="comment">     */</span>
<a name="l00247"></a>00247 }
<a name="l00248"></a>00248 
<a name="l00266"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae9ad1a2d64fe73b2a3413b2c4c18b1b3">00266</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae9ad1a2d64fe73b2a3413b2c4c18b1b3" title="插入节点到指定位置">sclnk_insert</a>(sclnk_iter prev, 
<a name="l00267"></a>00267                         sclnk_iter pos, sclnk_node* newly)
<a name="l00268"></a>00268 {
<a name="l00269"></a>00269     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(newly, prev, pos);
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271 
<a name="l00290"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4d8971bd97261a9c6886b68eba5fffc7">00290</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4d8971bd97261a9c6886b68eba5fffc7" title="擦除节点">sclnk_erase</a>(sclnk_iter prev, sclnk_iter entry)
<a name="l00291"></a>00291 {   <span class="comment">/* 将entry节点从表中移除</span>
<a name="l00292"></a>00292 <span class="comment">     *                              (entry)</span>
<a name="l00293"></a>00293 <span class="comment">     *  -(prev)-(entry)-()- ===&gt; </span>
<a name="l00294"></a>00294 <span class="comment">     *                           --(prev)--()--</span>
<a name="l00295"></a>00295 <span class="comment">     */</span>
<a name="l00296"></a>00296     prev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = entry-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00297"></a>00297 }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299 NV_API <span class="keywordtype">void</span> __sclnk_free(sclnk_iter begin, sclnk_iter end, 
<a name="l00300"></a>00300                         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270" title="单参数回调函数指针">sclnk_pr1</a> erase_handler);
<a name="l00301"></a>00301 
<a name="l00313"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae897271833920bf21c614fe0365698d0">00313</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae897271833920bf21c614fe0365698d0" title="清空区域">sclnk_erases</a>(sclnk_iter bprev, sclnk_iter begin, 
<a name="l00314"></a>00314                             sclnk_iter end, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270" title="单参数回调函数指针">sclnk_pr1</a> erase_handler)
<a name="l00315"></a>00315 {
<a name="l00316"></a>00316     bprev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = end;
<a name="l00317"></a>00317     <span class="keywordflow">if</span> (erase_handler)
<a name="l00318"></a>00318         __sclnk_free(begin, end, erase_handler);
<a name="l00319"></a>00319 }
<a name="l00320"></a>00320 
<a name="l00329"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1b14e4e39781624881131b8b5016a205">00329</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1b14e4e39781624881131b8b5016a205" title="清空表">sclnk_clear</a>(sclnk_head* head, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270" title="单参数回调函数指针">sclnk_pr1</a> erase_handler)
<a name="l00330"></a>00330 {
<a name="l00331"></a>00331     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae897271833920bf21c614fe0365698d0" title="清空区域">sclnk_erases</a>(head, head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, head, erase_handler);
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333 
<a name="l00340"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa84a7be161740782cf22977fad04db0b">00340</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa84a7be161740782cf22977fad04db0b" title="在表首添加节点">sclnk_push_front</a>(sclnk_head* head, sclnk_node* newly)
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(newly, head, head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344 
<a name="l00350"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga739b0099ea2a0a43019d9e9df676cf2c">00350</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga739b0099ea2a0a43019d9e9df676cf2c" title="移除表首节点">sclnk_pop_front</a>(sclnk_head* head)
<a name="l00351"></a>00351 {
<a name="l00352"></a>00352     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6655e61e67c2f0cd0206fdd22af55948" title="链接两个节点">sclnk_link</a>(head, head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00353"></a>00353 }
<a name="l00354"></a>00354 
<a name="l00370"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga80f9d833c31b2ef13a5ad913e1097cf6">00370</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga80f9d833c31b2ef13a5ad913e1097cf6" title="在两个节点之间插入多个连续节点">sclnk_splice_between</a>(
<a name="l00371"></a>00371     sclnk_iter prev, sclnk_iter <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, 
<a name="l00372"></a>00372     sclnk_iter first_prev, sclnk_iter first, 
<a name="l00373"></a>00373     sclnk_iter last, sclnk_iter last_next)
<a name="l00374"></a>00374 {   <span class="comment">/* 将first节点至last节点的部分从旧表(B表)移接到新表(A表)中 </span>
<a name="l00375"></a>00375 <span class="comment">     * (从first到last是按next方向)</span>
<a name="l00376"></a>00376 <span class="comment">     * A:  -(prev)-(next)-      </span>
<a name="l00377"></a>00377 <span class="comment">     * B: -(first_prev)-(first)-...-(last)-(last_next)-</span>
<a name="l00378"></a>00378 <span class="comment">     * to:</span>
<a name="l00379"></a>00379 <span class="comment">     * A: -(prev)-(first)-...-(last)-(next)-</span>
<a name="l00380"></a>00380 <span class="comment">     * B: -(first_prev)-(last_next)-</span>
<a name="l00381"></a>00381 <span class="comment">     */</span>
<a name="l00382"></a>00382     last-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = <a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00383"></a>00383     prev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = first;
<a name="l00384"></a>00384     first_prev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = last_next;
<a name="l00385"></a>00385 }
<a name="l00386"></a>00386 
<a name="l00405"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae76bde8fdf6caa919f7f0e5d16ecc564">00405</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae76bde8fdf6caa919f7f0e5d16ecc564" title="在两个节点之间插入多个连续节点">sclnk_splice</a>(sclnk_iter prev, sclnk_iter pos, 
<a name="l00406"></a>00406                 sclnk_iter first_prev, sclnk_iter first, sclnk_iter last)
<a name="l00407"></a>00407 {
<a name="l00408"></a>00408     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga80f9d833c31b2ef13a5ad913e1097cf6" title="在两个节点之间插入多个连续节点">sclnk_splice_between</a>(prev, pos, first_prev, first, last, last-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00409"></a>00409 }
<a name="l00410"></a>00410 
<a name="l00417"></a>00417 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c2368c8b739c616e4a31cdb70e0f109" title="统计表的节点数量">sclnk_count</a>(sclnk_head* head);
<a name="l00418"></a>00418 
<a name="l00427"></a>00427 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0d3b25cd83d8ae088a5a052be9a19c90" title="计算两个节点的迭代距离">sclnk_distance</a>(sclnk_iter first, sclnk_iter last);
<a name="l00428"></a>00428 
<a name="l00437"></a>00437 NV_API sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4f486152712faaff0fd27a48f3ea3e50" title="给迭代器增加一段距离或减小一段距离">sclnk_advance</a>(sclnk_head* head, sclnk_iter cur, <span class="keywordtype">size_t</span> dist);
<a name="l00438"></a>00438 
<a name="l00446"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0329e054c0783dac4ce6263ab83d72e1">00446</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0329e054c0783dac4ce6263ab83d72e1" title="根据正向索引得到迭代器">sclnk_at</a>(sclnk_head* head, <span class="keyword">const</span> <span class="keywordtype">size_t</span> index)
<a name="l00447"></a>00447 {
<a name="l00448"></a>00448     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4f486152712faaff0fd27a48f3ea3e50" title="给迭代器增加一段距离或减小一段距离">sclnk_advance</a>(head, head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, index);
<a name="l00449"></a>00449 }
<a name="l00450"></a>00450 
<a name="l00458"></a>00458 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaba18db2b0803f2dc314109f95266e92a" title="计算迭代器的正向索引">sclnk_index_of</a>(sclnk_head* head, sclnk_iter itr);
<a name="l00459"></a>00459 
<a name="l00465"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2aecfe697f1a6d22106200dd3c1bc72b">00465</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2aecfe697f1a6d22106200dd3c1bc72b" title="初始化节点">sclnk_node_init</a>(sclnk_node* entry)
<a name="l00466"></a>00466 {
<a name="l00467"></a>00467     entry-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = entry;
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 
<a name="l00478"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf8090f7bf0fb7bb21cc80ba7343c1338">00478</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf8090f7bf0fb7bb21cc80ba7343c1338" title="用新节点替换目标节点">sclnk_iter_replace</a>(sclnk_node* vprev, 
<a name="l00479"></a>00479                             sclnk_node* victim, sclnk_node* newly)
<a name="l00480"></a>00480 {   <span class="comment">/* 用newly节点替换表中的victim节点</span>
<a name="l00481"></a>00481 <span class="comment">     *      (newly)                     (victim)</span>
<a name="l00482"></a>00482 <span class="comment">     *                        ===&gt;</span>
<a name="l00483"></a>00483 <span class="comment">     * --(vprev)-(victim)-()--      --(vprev)-(newly)-()--</span>
<a name="l00484"></a>00484 <span class="comment">     */</span>
<a name="l00485"></a>00485     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(newly, vprev, victim-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00486"></a>00486 }
<a name="l00487"></a>00487 
<a name="l00488"></a>00488 NV_API <span class="keywordtype">void</span> __sclnk_iter_swap(
<a name="l00489"></a>00489     sclnk_iter aprev, sclnk_iter a, sclnk_iter anext, 
<a name="l00490"></a>00490     sclnk_iter bprev, sclnk_iter b, sclnk_iter bnext);
<a name="l00491"></a>00491 
<a name="l00501"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaaa9af21e07666138c54ee42af045b928">00501</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaaa9af21e07666138c54ee42af045b928" title="交换两个节点">sclnk_iter_swap</a>(sclnk_iter aprev, sclnk_iter a, 
<a name="l00502"></a>00502                                     sclnk_iter bprev, sclnk_iter b)
<a name="l00503"></a>00503 {
<a name="l00504"></a>00504     __sclnk_iter_swap(aprev, a, a-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, bprev, b, b-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00505"></a>00505 }
<a name="l00506"></a>00506 
<a name="l00515"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf5234e26dee066941c79e2af19e5dd54">00515</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf5234e26dee066941c79e2af19e5dd54" title="用新表头替换目标表头">sclnk_replace</a>(sclnk_head* victim, 
<a name="l00516"></a>00516                             sclnk_iter vlast, sclnk_head* newly)
<a name="l00517"></a>00517 {   <span class="comment">/* 用newly头替换表中的victim头</span>
<a name="l00518"></a>00518 <span class="comment">     *      [newly]                   [victim]</span>
<a name="l00519"></a>00519 <span class="comment">     *                        ===&gt;</span>
<a name="l00520"></a>00520 <span class="comment">     * --(vlast)-[victim]-()--    --(vlast)-[newly]-()--</span>
<a name="l00521"></a>00521 <span class="comment">     */</span>
<a name="l00522"></a>00522     vlast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = newly;
<a name="l00523"></a>00523     newly-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = victim-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00524"></a>00524 }
<a name="l00525"></a>00525 
<a name="l00526"></a>00526 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __sclnk_swap(
<a name="l00527"></a>00527     sclnk_iter a, sclnk_iter afront, sclnk_iter alast, 
<a name="l00528"></a>00528     sclnk_iter b, sclnk_iter bfront, sclnk_iter blast)
<a name="l00529"></a>00529 {   <span class="comment">/* 交换a、b两个头</span>
<a name="l00530"></a>00530 <span class="comment">     * --(alast)-[a]-(afront)--       --(alast)-[b]-(afront)--</span>
<a name="l00531"></a>00531 <span class="comment">     *                         ===&gt;</span>
<a name="l00532"></a>00532 <span class="comment">     * --(blast)-[b]-(bfront)--       --(blast)-[a]-(afront)--</span>
<a name="l00533"></a>00533 <span class="comment">     */</span>
<a name="l00534"></a>00534     blast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = a;
<a name="l00535"></a>00535     a-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = bfront;
<a name="l00536"></a>00536     alast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = b;
<a name="l00537"></a>00537     b-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = afront;
<a name="l00538"></a>00538 }
<a name="l00539"></a>00539 
<a name="l00549"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6b4befe4157b371fc3e8d6d9edb9c9ea">00549</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6b4befe4157b371fc3e8d6d9edb9c9ea" title="交换两个表头">sclnk_swap</a>(sclnk_head* a, sclnk_head* alast, 
<a name="l00550"></a>00550                                 sclnk_head* b, sclnk_head* blast)
<a name="l00551"></a>00551 {
<a name="l00552"></a>00552     __sclnk_swap(a, a-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, alast, b, b-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>, blast);
<a name="l00553"></a>00553 }
<a name="l00554"></a>00554 
<a name="l00564"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga26cc730daad81c94fae84637b5ea11c2">00564</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga26cc730daad81c94fae84637b5ea11c2" title="判断一个节点是否存在于表中">sclnk_exist</a>(sclnk_head* head, sclnk_iter itr)
<a name="l00565"></a>00565 {
<a name="l00566"></a>00566     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaba18db2b0803f2dc314109f95266e92a" title="计算迭代器的正向索引">sclnk_index_of</a>(head, itr) != (size_t)(-1);
<a name="l00567"></a>00567 }
<a name="l00568"></a>00568 
<a name="l00575"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9997297a01740b60bead4d685050dbf1">00575</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9997297a01740b60bead4d685050dbf1" title="得到表首节点">sclnk_front</a>(sclnk_head* head)
<a name="l00576"></a>00576 {
<a name="l00577"></a>00577     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00578"></a>00578 }
<a name="l00579"></a>00579 
<a name="l00598"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga462c5c4621c938c4f4b118ddbc5f0963">00598</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga462c5c4621c938c4f4b118ddbc5f0963" title="得到指向正向起始位置的迭代器">sclnk_begin</a>(sclnk_head* head)
<a name="l00599"></a>00599 {
<a name="l00600"></a>00600     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00601"></a>00601 }
<a name="l00602"></a>00602 
<a name="l00622"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad3d804bd815b92b46f12e2e1703e5b8c">00622</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad3d804bd815b92b46f12e2e1703e5b8c" title="得到指向正向起始位置前驱的迭代器">sclnk_pbegin</a>(sclnk_head* head)
<a name="l00623"></a>00623 {
<a name="l00624"></a>00624     <span class="keywordflow">return</span> head;
<a name="l00625"></a>00625 }
<a name="l00626"></a>00626 
<a name="l00634"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8488bd60be74a89d6b7f887f534a5408">00634</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8488bd60be74a89d6b7f887f534a5408" title="得到指向正向终止位置的迭代器">sclnk_end</a>(sclnk_head* head)
<a name="l00635"></a>00635 {
<a name="l00636"></a>00636     <span class="keywordflow">return</span> head;
<a name="l00637"></a>00637 }
<a name="l00638"></a>00638 
<a name="l00645"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1a649a7d0d8926f3ca47111a6f03333f">00645</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1a649a7d0d8926f3ca47111a6f03333f" title="得到当前迭代器的正向终止位置">sclnk_end_of</a>(sclnk_iter itr)
<a name="l00646"></a>00646 {
<a name="l00647"></a>00647     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00648"></a>00648 }
<a name="l00649"></a>00649 
<a name="l00656"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c4203f3e474bfef4705505c047047f2">00656</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c4203f3e474bfef4705505c047047f2" title="得到当前节点的后继节点">sclnk_next</a>(sclnk_iter itr)
<a name="l00657"></a>00657 {
<a name="l00658"></a>00658     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00659"></a>00659 }
<a name="l00660"></a>00660 
<a name="l00661"></a>00661 <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter __sclnk_inc_later(sclnk_iter cur, sclnk_iter* p)
<a name="l00662"></a>00662 {
<a name="l00663"></a>00663     *p = cur-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00664"></a>00664     <span class="keywordflow">return</span> cur;
<a name="l00665"></a>00665 }
<a name="l00666"></a>00666 
<a name="l00675"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c63ec804c220dc76dc32687212c2bb9">00675</a> <span class="preprocessor">#define sclnk_inc(itr) ((itr) = (itr)-&gt;next)</span>
<a name="l00676"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6d3c931e93fa85e8d647bfc2525fc134">00676</a> <span class="preprocessor"></span><span class="preprocessor">#define sclnk_prev_inc(itr, prev) ((prev) = (itr), sclnk_inc(itr))</span>
<a name="l00677"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0ae905a556af3efe6a608b57a8ff9c94">00677</a> <span class="preprocessor"></span><span class="preprocessor">#define sclnk_inc_later(itr) __sclnk_inc_later(itr, &amp;(itr))</span>
<a name="l00678"></a>00678 <span class="preprocessor"></span>
<a name="l00688"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6064f6324b59128b3f2f9b6237e2795f">00688</a> <span class="preprocessor">#define sclnk_foreach(_begin, _end, fn, type, member) \</span>
<a name="l00689"></a>00689 <span class="preprocessor">    do {sclnk_iter _q_e = (_end);                           \</span>
<a name="l00690"></a>00690 <span class="preprocessor">        sclnk_iter _q_f = (_begin);                         \</span>
<a name="l00691"></a>00691 <span class="preprocessor">        while (_q_f != _q_e) {                              \</span>
<a name="l00692"></a>00692 <span class="preprocessor">            type * _q_t = container_of(_q_f, type, member); \</span>
<a name="l00693"></a>00693 <span class="preprocessor">            _q_f = _q_f-&gt;next;                              \</span>
<a name="l00694"></a>00694 <span class="preprocessor">            fn(_q_t);                                       \</span>
<a name="l00695"></a>00695 <span class="preprocessor">        }                                                   \</span>
<a name="l00696"></a>00696 <span class="preprocessor">    } while (0)</span>
<a name="l00697"></a>00697 <span class="preprocessor"></span>
<a name="l00710"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf21d6d1654af1b15ac7b9d1e314844a2">00710</a> <span class="preprocessor">#define sclnk_search(head, _begin, _end, equal, var, res, type, member) do {\</span>
<a name="l00711"></a>00711 <span class="preprocessor">        sclnk_iter _q_e = (_end);                               \</span>
<a name="l00712"></a>00712 <span class="preprocessor">        sclnk_iter _q_f = (_begin);                             \</span>
<a name="l00713"></a>00713 <span class="preprocessor">        sclnk_head* _q_h = (head);                              \</span>
<a name="l00714"></a>00714 <span class="preprocessor">        (res) = NULL;                                           \</span>
<a name="l00715"></a>00715 <span class="preprocessor">        while (_q_f != _q_e) {                                  \</span>
<a name="l00716"></a>00716 <span class="preprocessor">            type * _q_cb = container_of(_q_f, type, member);    \</span>
<a name="l00717"></a>00717 <span class="preprocessor">            if (equal(_q_cb, (val))) {                          \</span>
<a name="l00718"></a>00718 <span class="preprocessor">                (res) = _q_cb;                                  \</span>
<a name="l00719"></a>00719 <span class="preprocessor">                break;                                          \</span>
<a name="l00720"></a>00720 <span class="preprocessor">            }                                                   \</span>
<a name="l00721"></a>00721 <span class="preprocessor">            _q_f = _q_f-&gt;next;                                  \</span>
<a name="l00722"></a>00722 <span class="preprocessor">        }                                                       \</span>
<a name="l00723"></a>00723 <span class="preprocessor">    } while (0)</span>
<a name="l00724"></a>00724 <span class="preprocessor"></span>
<a name="l00725"></a>00725 <span class="comment">/* 反转链表的两种方式：</span>
<a name="l00726"></a>00726 <span class="comment"> * (1) 直接使用 sclnk_reverse(head); (推荐)</span>
<a name="l00727"></a>00727 <span class="comment"> * (2) 按照如下方式迭代</span>
<a name="l00728"></a>00728 <span class="comment"> *     sclnk_iter i = sclnk_vbegin(head);</span>
<a name="l00729"></a>00729 <span class="comment"> *     sclnk_iter e = sclnk_vend(head);</span>
<a name="l00730"></a>00730 <span class="comment"> *     while (i != e) {</span>
<a name="l00731"></a>00731 <span class="comment"> *          sclnk_vpush(head, i);</span>
<a name="l00732"></a>00732 <span class="comment"> *     }</span>
<a name="l00733"></a>00733 <span class="comment"> *     当迭代完成时，反转完成</span>
<a name="l00734"></a>00734 <span class="comment"> */</span>
<a name="l00735"></a>00735 
<a name="l00736"></a>00736 <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter __sclnk_vbegin(sclnk_head* head, sclnk_iter front)
<a name="l00737"></a>00737 {
<a name="l00738"></a>00738     head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = head;
<a name="l00739"></a>00739     <span class="keywordflow">return</span> front;
<a name="l00740"></a>00740 }
<a name="l00741"></a>00741 
<a name="l00758"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga33ab0148a458bbc3a45d9ab58b3af75b">00758</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga33ab0148a458bbc3a45d9ab58b3af75b" title="得到用于反转的起始位置的迭代器">sclnk_vbegin</a>(sclnk_head* head)
<a name="l00759"></a>00759 {
<a name="l00760"></a>00760     <span class="keywordflow">return</span> __sclnk_vbegin(head, head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>);
<a name="l00761"></a>00761 }
<a name="l00762"></a>00762 
<a name="l00779"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7c89eff8cd82862599fea6c9eb460836">00779</a> <span class="keyword">static</span> <span class="keyword">inline</span> sclnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7c89eff8cd82862599fea6c9eb460836" title="得到用于反转的终止位置的迭代器">sclnk_vend</a>(sclnk_head* head)
<a name="l00780"></a>00780 {
<a name="l00781"></a>00781     <span class="keywordflow">return</span> head;
<a name="l00782"></a>00782 }
<a name="l00783"></a>00783 
<a name="l00800"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa2764d0d3c341ee6915de4c6e50c4081">00800</a> <span class="preprocessor">#define sclnk_vpush(head, itr) sclnk_push_front(head, sclnk_inc_later(itr))</span>
<a name="l00801"></a>00801 <span class="preprocessor"></span>
<a name="l00808"></a>00808 NV_API <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga29a3829d5949bdecbc4d9911d0136c75" title="反转表">sclnk_reverse</a>(sclnk_head* head);
<a name="l00809"></a>00809 
<a name="l00810"></a>00810 NV_API <span class="keywordtype">void</span> __sclnk_serialize(sclnk_head* head, <span class="keywordtype">char</span>** buf, <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00811"></a>00811 
<a name="l00812"></a>00812 NV_API <span class="keywordtype">void</span> __sclnk_deserialize(sclnk_head* head, <span class="keywordtype">char</span>** buf, 
<a name="l00813"></a>00813                             <span class="keywordtype">size_t</span> cnt, <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00814"></a>00814 
<a name="l00844"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaee0c8704431a04be07dd7b7a4edc8baf">00844</a> <span class="preprocessor">#define sclnk_serialize(head, buf, type, member) \</span>
<a name="l00845"></a>00845 <span class="preprocessor">    __sclnk_serialize(head, (char**)(buf), offset_of(type, member))</span>
<a name="l00846"></a>00846 <span class="preprocessor"></span>
<a name="l00877"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga458a15d62ffdc2897c44c9d98f2f4ec2">00877</a> <span class="preprocessor">#define sclnk_deserialize(head, buf, cnt, type, member) \</span>
<a name="l00878"></a>00878 <span class="preprocessor">    __sclnk_deserialize(head, (char**)(buf), cnt, offset_of(type, member))</span>
<a name="l00879"></a>00879 <span class="preprocessor"></span>
<a name="l00891"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa78e42661228ecaf9b0157c0856e10b0">00891</a> <span class="preprocessor">#define sclnk_sort_insert(head, newly, greater_equal, type, member) do {\</span>
<a name="l00892"></a>00892 <span class="preprocessor">        sclnk_iter _k_n = (newly);                              \</span>
<a name="l00893"></a>00893 <span class="preprocessor">        sclnk_head* _k_h = (head);                              \</span>
<a name="l00894"></a>00894 <span class="preprocessor">        sclnk_iter _k_j = _k_h;                                 \</span>
<a name="l00895"></a>00895 <span class="preprocessor">        sclnk_iter _k_i = _k_h-&gt;next;                           \</span>
<a name="l00896"></a>00896 <span class="preprocessor">        while (_k_i != _k_h) {                                  \</span>
<a name="l00897"></a>00897 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00898"></a>00898 <span class="preprocessor">            type * _k_pn = container_of(_k_n, type, member);    \</span>
<a name="l00899"></a>00899 <span class="preprocessor">            if (greater_equal(_k_pi, _k_pn))                    \</span>
<a name="l00900"></a>00900 <span class="preprocessor">                break;                                          \</span>
<a name="l00901"></a>00901 <span class="preprocessor">            _k_j = _k_i;                                        \</span>
<a name="l00902"></a>00902 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                  \</span>
<a name="l00903"></a>00903 <span class="preprocessor">        }                                                       \</span>
<a name="l00904"></a>00904 <span class="preprocessor">        sclnk_insert(_k_j, _k_i, _k_n);                         \</span>
<a name="l00905"></a>00905 <span class="preprocessor">    } while (0)</span>
<a name="l00906"></a>00906 <span class="preprocessor"></span>
<a name="l00921"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7b1159abb4f34066c0ad2a96cc2aecc1">00921</a> <span class="preprocessor">#define sclnk_is_sorted(_begin, _end, greater_equal, res, type, member) do {\</span>
<a name="l00922"></a>00922 <span class="preprocessor">        sclnk_iter _k_e = (_end);                               \</span>
<a name="l00923"></a>00923 <span class="preprocessor">        sclnk_iter _k_i = (_begin);                             \</span>
<a name="l00924"></a>00924 <span class="preprocessor">        sclnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l00925"></a>00925 <span class="preprocessor">        (res) = 1;                                              \</span>
<a name="l00926"></a>00926 <span class="preprocessor">        while (_k_j != _k_e) {                                  \</span>
<a name="l00927"></a>00927 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00928"></a>00928 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l00929"></a>00929 <span class="preprocessor">            if (!(greater_equal(_k_pj, _k_pi))) {               \</span>
<a name="l00930"></a>00930 <span class="preprocessor">                (res) = 0;                                      \</span>
<a name="l00931"></a>00931 <span class="preprocessor">                break;                                          \</span>
<a name="l00932"></a>00932 <span class="preprocessor">            }                                                   \</span>
<a name="l00933"></a>00933 <span class="preprocessor">            _k_i = _k_j;                                        \</span>
<a name="l00934"></a>00934 <span class="preprocessor">            _k_j = _k_j-&gt;next;                                  \</span>
<a name="l00935"></a>00935 <span class="preprocessor">        }                                                       \</span>
<a name="l00936"></a>00936 <span class="preprocessor">    } while (0)</span>
<a name="l00937"></a>00937 <span class="preprocessor"></span>
<a name="l00938"></a>00938 <span class="comment">/* 单向环形链表排序性能比较</span>
<a name="l00939"></a>00939 <span class="comment"> * 随机数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序 (最低)</span>
<a name="l00940"></a>00940 <span class="comment"> * 顺序数据：(最高) 冒泡排序 &gt; 奇偶排序 &gt; 鸡尾酒排序 &gt;&gt; 插入排序 &gt; 选择排序  (最低)</span>
<a name="l00941"></a>00941 <span class="comment"> * 逆序数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序  (最低)</span>
<a name="l00942"></a>00942 <span class="comment"> */</span>
<a name="l00943"></a>00943 
<a name="l00957"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gabda87e9246d72cfc3d3e872a31344e77">00957</a> <span class="preprocessor">#define sclnk_bubble_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l00958"></a>00958 <span class="preprocessor">        int _k_pc = 1;                                              \</span>
<a name="l00959"></a>00959 <span class="preprocessor">        sclnk_iter _k_e = (_end);                                   \</span>
<a name="l00960"></a>00960 <span class="preprocessor">        sclnk_iter _k_i = (_begin);                                 \</span>
<a name="l00961"></a>00961 <span class="preprocessor">        sclnk_iter _k_ip = (bprev);                                 \</span>
<a name="l00962"></a>00962 <span class="preprocessor">        for (; _k_pc &amp;&amp; _k_i != _k_e; _k_i = _k_i-&gt;next) {          \</span>
<a name="l00963"></a>00963 <span class="preprocessor">            sclnk_iter _k_jp = _k_i;                                \</span>
<a name="l00964"></a>00964 <span class="preprocessor">            sclnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l00965"></a>00965 <span class="preprocessor">            for (_k_pc = 0; _k_j != _k_e; _k_j = _k_j-&gt;next) {      \</span>
<a name="l00966"></a>00966 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00967"></a>00967 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l00968"></a>00968 <span class="preprocessor">                if (greater(_k_pi, _k_pj)) {                        \</span>
<a name="l00969"></a>00969 <span class="preprocessor">                    sclnk_iter _k_t = _k_i;                         \</span>
<a name="l00970"></a>00970 <span class="preprocessor">                    _k_i = _k_j;                                    \</span>
<a name="l00971"></a>00971 <span class="preprocessor">                    _k_j = _k_t;                                    \</span>
<a name="l00972"></a>00972 <span class="preprocessor">                    sclnk_iter_swap(_k_jp, _k_i, _k_ip, _k_j);      \</span>
<a name="l00973"></a>00973 <span class="preprocessor">                    _k_pc = 1;                                      \</span>
<a name="l00974"></a>00974 <span class="preprocessor">                }                                                   \</span>
<a name="l00975"></a>00975 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l00976"></a>00976 <span class="preprocessor">            }                                                       \</span>
<a name="l00977"></a>00977 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l00978"></a>00978 <span class="preprocessor">        }                                                           \</span>
<a name="l00979"></a>00979 <span class="preprocessor">    } while (0)</span>
<a name="l00980"></a>00980 <span class="preprocessor"></span>
<a name="l00994"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga66b8d85b4f0e05c5ce1b6e9cb204f7e7">00994</a> <span class="preprocessor">#define sclnk_oddeven_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l00995"></a>00995 <span class="preprocessor">        int _k_pc = 1;                                                      \</span>
<a name="l00996"></a>00996 <span class="preprocessor">        sclnk_iter _k_e = (_end);                                           \</span>
<a name="l00997"></a>00997 <span class="preprocessor">        sclnk_iter _k_f = (_begin);                                         \</span>
<a name="l00998"></a>00998 <span class="preprocessor">        sclnk_iter _k_p = (bprev);                                          \</span>
<a name="l00999"></a>00999 <span class="preprocessor">        while (_k_pc) {                                                     \</span>
<a name="l01000"></a>01000 <span class="preprocessor">            _k_pc = 0;                                                      \</span>
<a name="l01001"></a>01001 <span class="preprocessor">            _k_f = _k_p-&gt;next;                                              \</span>
<a name="l01002"></a>01002 <span class="preprocessor">            __sclnk_oddeven_scan(greater, type, member, _k_p, _k_f);        \</span>
<a name="l01003"></a>01003 <span class="preprocessor">            __sclnk_oddeven_scan(greater, type, member, _k_f, _k_f-&gt;next);  \</span>
<a name="l01004"></a>01004 <span class="preprocessor">        }                                                                   \</span>
<a name="l01005"></a>01005 <span class="preprocessor">    } while (0)</span>
<a name="l01006"></a>01006 <span class="preprocessor"></span>
<a name="l01007"></a>01007 <span class="preprocessor">#define __sclnk_oddeven_scan(greater, type, member, prev, _start) do {\</span>
<a name="l01008"></a>01008 <span class="preprocessor">        sclnk_iter _k_ip = prev;                                \</span>
<a name="l01009"></a>01009 <span class="preprocessor">        sclnk_iter _k_i = _start;                               \</span>
<a name="l01010"></a>01010 <span class="preprocessor">        sclnk_iter _k_jp = _k_i;                                \</span>
<a name="l01011"></a>01011 <span class="preprocessor">        sclnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l01012"></a>01012 <span class="preprocessor">        while (_k_j != _k_e &amp;&amp; _k_i != _k_e) {                  \</span>
<a name="l01013"></a>01013 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l01014"></a>01014 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01015"></a>01015 <span class="preprocessor">            if (greater(_k_pi, _k_pj)) {                        \</span>
<a name="l01016"></a>01016 <span class="preprocessor">                sclnk_iter _k_t = _k_i;                         \</span>
<a name="l01017"></a>01017 <span class="preprocessor">                _k_i = _k_j;                                    \</span>
<a name="l01018"></a>01018 <span class="preprocessor">                _k_j = _k_t;                                    \</span>
<a name="l01019"></a>01019 <span class="preprocessor">                sclnk_iter_swap(_k_jp, _k_i, _k_ip, _k_j);      \</span>
<a name="l01020"></a>01020 <span class="preprocessor">                _k_pc = 1;                                      \</span>
<a name="l01021"></a>01021 <span class="preprocessor">            }                                                   \</span>
<a name="l01022"></a>01022 <span class="preprocessor">            _k_ip = _k_j;                                       \</span>
<a name="l01023"></a>01023 <span class="preprocessor">            _k_i = _k_j-&gt;next;                                  \</span>
<a name="l01024"></a>01024 <span class="preprocessor">            _k_jp = _k_i;                                       \</span>
<a name="l01025"></a>01025 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                  \</span>
<a name="l01026"></a>01026 <span class="preprocessor">        }                                                       \</span>
<a name="l01027"></a>01027 <span class="preprocessor">    } while (0)</span>
<a name="l01028"></a>01028 <span class="preprocessor"></span>
<a name="l01042"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3260083e2d97e61a3f8f35d020a05e34">01042</a> <span class="preprocessor">#define sclnk_select_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l01043"></a>01043 <span class="preprocessor">        sclnk_iter _k_e = (_end);                                   \</span>
<a name="l01044"></a>01044 <span class="preprocessor">        sclnk_iter _k_i = (_begin);                                 \</span>
<a name="l01045"></a>01045 <span class="preprocessor">        sclnk_iter _k_ip = (bprev);                                 \</span>
<a name="l01046"></a>01046 <span class="preprocessor">        sclnk_iter _k_jp = _k_i;                                    \</span>
<a name="l01047"></a>01047 <span class="preprocessor">        sclnk_iter _k_j = _k_i-&gt;next;                               \</span>
<a name="l01048"></a>01048 <span class="preprocessor">        while (_k_j != _k_e) {                                      \</span>
<a name="l01049"></a>01049 <span class="preprocessor">            sclnk_iter _k_mp = _k_ip;                               \</span>
<a name="l01050"></a>01050 <span class="preprocessor">            sclnk_iter _k_m = _k_i;                                 \</span>
<a name="l01051"></a>01051 <span class="preprocessor">            while (_k_j != _k_e) {                                  \</span>
<a name="l01052"></a>01052 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01053"></a>01053 <span class="preprocessor">                type * _k_pm = container_of(_k_m, type, member);    \</span>
<a name="l01054"></a>01054 <span class="preprocessor">                if (greater(_k_pm, _k_pj)) {                        \</span>
<a name="l01055"></a>01055 <span class="preprocessor">                    _k_mp = _k_jp;                                  \</span>
<a name="l01056"></a>01056 <span class="preprocessor">                    _k_m = _k_j;                                    \</span>
<a name="l01057"></a>01057 <span class="preprocessor">                }                                                   \</span>
<a name="l01058"></a>01058 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l01059"></a>01059 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01060"></a>01060 <span class="preprocessor">            }                                                       \</span>
<a name="l01061"></a>01061 <span class="preprocessor">            if (_k_i != _k_m) {                                     \</span>
<a name="l01062"></a>01062 <span class="preprocessor">                sclnk_iter _k_t = _k_m;                             \</span>
<a name="l01063"></a>01063 <span class="preprocessor">                _k_m = _k_i;                                        \</span>
<a name="l01064"></a>01064 <span class="preprocessor">                _k_i = _k_t;                                        \</span>
<a name="l01065"></a>01065 <span class="preprocessor">                sclnk_iter_swap(_k_ip, _k_m, _k_mp, _k_i);          \</span>
<a name="l01066"></a>01066 <span class="preprocessor">            }                                                       \</span>
<a name="l01067"></a>01067 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l01068"></a>01068 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                      \</span>
<a name="l01069"></a>01069 <span class="preprocessor">            _k_jp = _k_i;                                           \</span>
<a name="l01070"></a>01070 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                      \</span>
<a name="l01071"></a>01071 <span class="preprocessor">        }                                                           \</span>
<a name="l01072"></a>01072 <span class="preprocessor">    } while (0)</span>
<a name="l01073"></a>01073 <span class="preprocessor"></span>
<a name="l01086"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga19aab19ebb8c624c59b53bc61b2a2f19">01086</a> <span class="preprocessor">#define sclnk_insert_sort(bprev, _begin, _end, greater_equal, type, member) \</span>
<a name="l01087"></a>01087 <span class="preprocessor">    do {sclnk_iter _k_e = (_end);                                   \</span>
<a name="l01088"></a>01088 <span class="preprocessor">        sclnk_iter _k_f = (_begin);                                 \</span>
<a name="l01089"></a>01089 <span class="preprocessor">        sclnk_iter _k_p = (bprev);                                  \</span>
<a name="l01090"></a>01090 <span class="preprocessor">        sclnk_iter _k_ip = _k_f;                                    \</span>
<a name="l01091"></a>01091 <span class="preprocessor">        sclnk_iter _k_i = _k_f-&gt;next;                               \</span>
<a name="l01092"></a>01092 <span class="preprocessor">        for (; _k_i != _k_e; _k_i = _k_i-&gt;next) {                   \</span>
<a name="l01093"></a>01093 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01094"></a>01094 <span class="preprocessor">            sclnk_iter _k_jp = _k_p;                                \</span>
<a name="l01095"></a>01095 <span class="preprocessor">            sclnk_iter _k_j = _k_p-&gt;next;                           \</span>
<a name="l01096"></a>01096 <span class="preprocessor">            while (_k_j != _k_i) {                                  \</span>
<a name="l01097"></a>01097 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01098"></a>01098 <span class="preprocessor">                if (greater_equal(_k_pj, _k_pi)) {                  \</span>
<a name="l01099"></a>01099 <span class="preprocessor">                    sclnk_iter _k_t = _k_i;                         \</span>
<a name="l01100"></a>01100 <span class="preprocessor">                    _k_i = _k_ip;                                   \</span>
<a name="l01101"></a>01101 <span class="preprocessor">                    sclnk_erase(_k_ip, _k_t);                       \</span>
<a name="l01102"></a>01102 <span class="preprocessor">                    sclnk_insert(_k_jp, _k_j, _k_t);                \</span>
<a name="l01103"></a>01103 <span class="preprocessor">                    break;                                          \</span>
<a name="l01104"></a>01104 <span class="preprocessor">                }                                                   \</span>
<a name="l01105"></a>01105 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l01106"></a>01106 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01107"></a>01107 <span class="preprocessor">            }                                                       \</span>
<a name="l01108"></a>01108 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l01109"></a>01109 <span class="preprocessor">        }                                                           \</span>
<a name="l01110"></a>01110 <span class="preprocessor">    } while (0)</span>
<a name="l01111"></a>01111 <span class="preprocessor"></span>
<a name="l01114"></a>01114 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l01115"></a>01115 <span class="preprocessor"></span>}
<a name="l01116"></a>01116 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l01117"></a>01117 
<a name="l01118"></a>01118 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_SCLNK__ */</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
